/** add by shirly 2024-03-25 sod_cum_qty[1] update*/
{us/mf/mfdtitle.i "2+ "}



define variable l-yn as logical initial yes format "Y/N".
define variable init_day as date.



form
  l-yn colon 20 label "update"
  with frame a  width 80 side-labels.
setFrameLabels(frame a:handle).


repeat:
  init_day = ?.
  update l-yn with frame a.

  if l-yn = no then next.
  
  for each sod_det where sod_domain = global_domain 
                   /*and sod_nbr = "HQWS001"  
                     */                     
                                          
                     and ((sod_start_eff[1] <= today or sod_start_eff[1]  = ?)
                     and (sod_end_eff[1]   >= today or sod_end_eff[1]    = ?))    
                     and sod_curr_rlse_id[3] <> "" :

         
      find first sch_mstr no-lock where sch_domain = global_domain
      and sch_type = 3 and sch_nbr = sod_nbr and sch_line = sod_line 
      and sch_rlse_id = sod_curr_rlse_id[3] no-error.
      for each  schd_det no-lock where schd_domain = global_domain  
      and schd_type = 3 and schd_nbr = sod_nbr  
      and schd_line = sod_line and schd_rlse_id = sod_curr_rlse_id[3] 
      and schd_date <= today - 1:
          accumulate schd_upd_qty(total).
      end.
      /*
      if available sch_mstr then disp sch_pcr_qty .
      disp accumulate total schd_upd_qty.
                                         */
      if available sch_mstr then 
      assign sod_cum_qty[1] = sch_pcr_qty + accum total schd_upd_qty .           
  end.                                                                                                                message "update complete!".
  pause 2.
end.
